from .weapon import *
from .title import *
from .stable import *
from .pet import *
from .params import *
from .old import *
from .merge import *
from .fusion import *
from .customize import *
from core.basic.property import CharacterProperty
from .specificity import *
from .divinity import *
from .suit import *
entry_func_list = {}  # id : enteyfunc 词条函数(数组)列表


def entry_0(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        return "空词条"
    if mode == 0:
        pass
    if mode == 1:
        pass

# region 部位固有属性


def entry_28(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        return ['该装备的成长属性等级之和每达到40，增加3%的技能攻击力', ' - 穿戴神话装备时不适用', ' - 仅适用上衣、手镯、耳环中最高的1个']
    if mode == 0:
        if not char.已穿戴神话():  # 判断是否穿戴神话装备
            x = sum(char.词条等级.get(part, [0]))
            temp = {}
            for i in ['上衣', '手镯', '耳环']:  # 计算3个部位最高值
                temp[i] = sum(char.词条等级.get(i, [0]))
            temp = sorted(temp.items(), key=lambda x: x[1], reverse=True)
            if part == temp[0][0]:
                char.技能攻击力加成(part=part, x=0.03 * int(min(320, x) / 40))
    if mode == 1:
        pass


def entry_29(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        return ['Lv30 buff技能Lv+1', 'Lv50 主动技能Lv+1']
    if mode == 0:
        char.buff技能等级加成(30, 1)
        char.技能等级加成('主动', 50, 50, 1)
    if mode == 1:
        pass


def entry_30(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        return ['Lv30 buff技能Lv+3', 'Lv50 主动技能Lv+4']
    if mode == 0:
        char.buff技能等级加成(30, 3)
        char.技能等级加成('主动', 50, 50, 4)
    if mode == 1:
        pass


def entry_10001(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        return ["成长属性240级以上时增加1%技能攻击，每40级增加1%"]
    if mode == 0:
        if char.穿戴低于105():
            return
        x = sum(char.词条等级.get(part, [0]))
        if x >= 240:
            char.技能攻击力加成(part=part, x=0.01 * int((min(320, x) - 200) / 40))
    if mode == 1:
        pass


def entry_10002(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (上衣)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10003(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (下装)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10004(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (头肩)
        if not sj:
            return ["技能伤害 +34%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +34%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.34)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10005(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (腰带)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10006(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (鞋)
        if not sj:
            return ["技能伤害 +29%", "移动速度 +4%"]
        else:
            return ['攻击强化 +204.8%', "技能伤害 +29%", "移动速度 +4%"]
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.29)
        char.移动速度增加(0.04)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10007(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (手镯)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10008(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (项链)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10009(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (戒指)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10010(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (辅助装备)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10011(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (魔法石)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10012(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (耳环)
        if not sj:
            return ["技能伤害 +12%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +12%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.12)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10013(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (胜负武器)
        if not sj:
            return ["技能伤害 +50%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +50%']
        # (胜负武器)
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.50)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10014(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (吞噬武器)
        if not sj:
            return ["技能伤害 +49%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +49%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.49)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10015(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (吞噬武器)
        if not sj:
            return ["技能伤害 +55%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +55%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.55)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass


def entry_10016(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        if not sj:
        # (吞噬武器)
            return ["增益量11695"]
        else:
            return ["增益量11887"]
    if mode == 0:
        if char.是否升级110(part):
            char.辅助属性加成(buff量=11887)
        else:
            char.辅助属性加成(buff量=11695)
    if mode == 1:
        pass


def entry_10017(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        return ["奶系 30级增益技能 Lv+3", "奶系 50级主动技能 Lv+4"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 3)
            char.技能等级加成('主动', 50, 50, 4)
    if mode == 1:
        pass


def entry_10018(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
      # (上衣)
        if not sj:
            return ["增益量 +1010", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +1202", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=1202)
            else:
                char.辅助属性加成(buff量=1010)
    if mode == 1:
        pass


def entry_10019(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (下装)
        if not sj:
            return ["增益量 +1010", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +1202", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=1202)
            else:
                char.辅助属性加成(buff量=1010)
    if mode == 1:
        pass


def entry_10020(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (头肩)
        if not sj:
            return ["增益量 +1010", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +1202", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=1202)
            else:
                char.辅助属性加成(buff量=1010)
    if mode == 1:
        pass


def entry_10021(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (腰带)
        if not sj:
            return ["增益量 +1010", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +1202", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=1202)
            else:
                char.辅助属性加成(buff量=1010)
    if mode == 1:
        pass


def entry_10022(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (鞋)
        if not sj:
            return ["增益量 +1010", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +1202", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=1202)
            else:
                char.辅助属性加成(buff量=1010)
    if mode == 1:
        pass


def entry_10023(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (手镯)
        if not sj:
            return ["增益量 +295", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +487", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=487)
            else:
                char.辅助属性加成(buff量=295)
    if mode == 1:
        pass


def entry_10024(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (项链)
        if not sj:
            return ["增益量 +295", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +487", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=487)
            else:
                char.辅助属性加成(buff量=295)
    if mode == 1:
        pass


def entry_10025(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (戒指)
        if not sj:
            return ["增益量 +295", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +487", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=487)
            else:
                char.辅助属性加成(buff量=295)
    if mode == 1:
        pass


def entry_10026(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (辅助装备)
        if not sj:
            return ["增益量 +1875", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +2067", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=2067)
            else:
                char.辅助属性加成(buff量=1875)
    if mode == 1:
        pass


def entry_10027(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (魔法石)
        if not sj:
            return ["增益量 +1875", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +2067", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=2067)
            else:
                char.辅助属性加成(buff量=1875)
    if mode == 1:
        pass


def entry_10028(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (耳环)
        if not sj:
            return ["增益量 +1010", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
        else:
            return ["增益量 +1202", "奶系 30级增益技能 Lv+1", "奶系 50级主动技能 Lv+1"]
    if mode == 0:
        if char.类型 == '辅助':
            char.技能等级加成('主动', 30, 30, 1)
            char.技能等级加成('主动', 50, 50, 1)
            if char.是否升级110(part):
                char.辅助属性加成(buff量=1202)
            else:
                char.辅助属性加成(buff量=1010)
    if mode == 1:
        pass


def entry_10029(char: CharacterProperty = {}, mode=0, text=False, part='', lv=0, params=[], sj=False, carry=True):
    if text:
        # (跨越者武器)
        if not sj:
            return ["技能伤害 +35%"]
        else:
            return ['攻击强化 +204.8%', '技能伤害 +35%']
    if mode == 0:
        char.技能攻击力加成(part=part, x=0.35)
        if char.是否升级110(part):
            char.攻击强化加成(204.8)
    if mode == 1:
        pass
# endregion


# region 部位固有属性
for i in range(10001, 10030):
    try:
        entry_func_list[i] = eval('entry_{}'.format(i))
    except:
        pass
# endregion 部位固有属性


# 目前成长词条范围
for i in range(2000):
    try:
        entry_func_list[i] = eval('entry_{}'.format(i))
    except:
        pass

for i in range(10101, 14000):
    try:
        entry_func_list[i] = eval('entry_{}'.format(i))
    except:
        pass


for i in range(14001, 14999):
    try:
        entry_func_list[i] = eval('entry_{}'.format(i))
    except:
        pass

# 特性词条
for i in range(20000,20400):
    try:
        entry_func_list[i] = eval('entry_{}'.format(i))
    except:
        pass

# 套装
for i in range(30001,39999):
    try:
        entry_func_list[i] = eval('entry_{}'.format(i))
    except:
        pass


entry_range = {
    "growth":[0,2000],
    "specificity":[20000,20400],
    "inherent":[10000,10030],
    "pet":[10101, 14000],
    "titile":[14001, 14999]
}

def get_info(type,char={}):
    if type == "specificity":
        return get_specificity_infos(char)
# 词条效果id范围 0~18999
    infolist = []
    keys =  entry_range.get(type,[0,0])
    for i in range(keys[0],keys[1]):
        try:
            data = {}
            data['id'] = i
            info = entry_func_list[i](char=char, text=True)
            num = 0
            for k in index:
                data[k] = info[num]
                num += 1
            infolist.append(data)
        except:
            break
    return infolist